CUDA C编程权威指南:2.1

您所在的位置:网站首页 cuda c编程权威指南epub CUDA C编程权威指南:2.1

CUDA C编程权威指南:2.1

2024-07-10 21:15| 来源: 网络整理| 查看: 265

#include #include 

#define CHECK(call)//{//    const cudaError_t error = call;//    if (error != cudaSuccess)//    {//        printf("Error: %s:%d, ", __FILE__, __LINE__);//        printf("code:%d, reason: %s\n", error, cudaGetErrorString(error));//        exit(1);//    }//}

void checkResult(float *hostRef, float *gpuRef, const int N){    double epsilon = 1.0E-8;    bool match = 1;    for (int i = 0; i  epsilon)        {            match = 0;            printf("Arrays do not match!\n");            printf("host %5.2f gpu %5.2f at current %d\n", hostRef[i], gpuRef[i], i);            break;        }    }    if (match) printf("Arrays match.\n\n");}

void initialData(float *ip, int size){    // generate different seed for random number    time_t t;    srand((unsigned int) time(&t));    for (int i = 0; i 



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3